Skip to content

fix(extensions): underscores are invalid in prerelease#174

Closed
roxspring wants to merge 8 commits intoFigureTechnologies:mainfrom
roxspring:fix/underscores-are-invalid
Closed

fix(extensions): underscores are invalid in prerelease#174
roxspring wants to merge 8 commits intoFigureTechnologies:mainfrom
roxspring:fix/underscores-are-invalid

Conversation

@roxspring
Copy link
Copy Markdown
Contributor

When using GitHub Actions & Dependabot I've been hitting the following:

1: Task failed with an exception.
-----------
* What went wrong:
A problem occurred configuring root project 'root-project'.
> io.github.z4kn4fein.semver.VersionFormatException: Pre-release part 'dependabot-github_actions-softprops-action-gh-release-2' contains an invalid character. (dependabot-github_actions-softprops-action-gh-release-2.1)
gradle/actions: Writing build results to /home/runner/work/_temp/.gradle-actions/build-results/__run-1758664924990.json

IIUC this boils down to an _ being contributed to the prerelease label which clearly is not a valid character.

This PR includes a test demonstrating the problem, a fix, and a required commit to update the copyright headers 🤷

@roxspring roxspring requested a review from a team as a code owner September 23, 2025 23:42
Copy link
Copy Markdown
Contributor

@tbcrawford tbcrawford left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi there! Thank you so much for your contribution and fixing this bug! I just have one tiny ask and I'd be happy to run this through and get a release cut soon. Actually, it looks like I was able to easily make this change. Let me get this run through here and get a new release out!

Looks like there is an issue with cross user branches. I will have to look at this later when I have more time.

const val R_REMOTES_ORIGIN = "$R_REMOTES$DEFAULT_REMOTE_NAME"

private val validCharacters: Regex = """[^0-9A-Za-z\-_.]+""".toRegex()
private val validCharacters: Regex = """[^0-9A-Za-z\-.]+""".toRegex()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you rename this to invalidSemverCharacters? Reading back over this didn't make much sense to me why we would be trying to replace all "valid characters" with - 😅

Suggested change
private val validCharacters: Regex = """[^0-9A-Za-z\-.]+""".toRegex()
private val invalidSemverCharacters: Regex = """[^0-9A-Za-z\-.]+""".toRegex()

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I also spent too long trying to figure out whether that was a list of the valid vs invalid characters. Renaming the val should make that a little clearer.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually... validCharacters is referenced again a few lines down which will also need updating to invalidSemverCharacters.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call! I overlooked that. Thanks!

@tbcrawford
Copy link
Copy Markdown
Contributor

@roxspring I ended up having to bring this branch (relevant PR) into the repository itself since I'm having issues with cross-repo pull requests at the moment. I have to look into that issue. You can find this fix published in 2.0.4. Thank you again for your contributions!

@tbcrawford tbcrawford closed this Sep 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants